home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir39 / bootcpu2.zip / BOOTCPU.BAS next >
BASIC Source File  |  1994-07-05  |  2KB  |  108 lines

  1. Rem * Bootcpu v2.0
  2. Rem * New features:
  3. Rem *  Boot selectable warm, or cold.
  4. Rem *  Wait for number of seconds before boot.
  5. Rem *  Test for certain time to reboot.
  6. Rem *  Returns dos errorlevel.
  7.  
  8. DefInt A-Z
  9. Boot.Type=0 ' 1=warm, 2=cold
  10. Wait.Time!=0 ' seconds to wait
  11. Start.Time!=0 ' time range begin
  12. Stop.Time!=0 ' time range end
  13. C$=Command$
  14. If C$="" Then
  15.   Goto Command.Line
  16. Endif
  17. While Len(C$)
  18.   D=Instr(C$," ")
  19.   If D>0 Then
  20.     D$=Left$(C$,D-1)
  21.     C$=Mid$(C$,D+1)
  22.   Else
  23.     D$=C$
  24.     C$=""
  25.   Endif
  26.   If D$="W" Then
  27.     Boot.Type=1
  28.   Else
  29.     If D$="C" Then
  30.       Boot.Type=2
  31.     Else
  32.       If Left$(D$,1)="+" Then
  33.         Wait.Time!=Int(Val(Mid$(D$,2)))
  34.       Else
  35.         If Instr(D$,",") Then
  36.           Start.Time!=Int(Val(Left$(D$,Instr(D$,",")-1)))
  37.           Stop.Time!=Int(Val(Mid$(D$,Instr(D$,",")+1)))
  38.         Else
  39.           Goto Command.Line
  40.         Endif
  41.       Endif
  42.     Endif
  43.   Endif
  44. Wend
  45. If Boot.Type=0 Goto Command.Line
  46. If Start.Time!>0 And Stop.Time!>0 Then
  47.   If Start.Time!>86400! Or Stop.Time!>86400! Then Goto Command.Line
  48.   If Start.Time!>Stop.Time! Goto Command.Line
  49. Endif
  50. Print "Bootcpu v2.0"
  51. If Start.Time!>0 And Stop.Time!>0 Then
  52.   If Start.Time!<Timer And Stop.Time!>Timer Then
  53.     If Wait.Time!>0 Then
  54.       Goto Reboot.Wait
  55.     Else
  56.       Goto Reboot
  57.     Endif
  58.   Else
  59.     Print "Time not within range."
  60.     End 4
  61.   Endif
  62. Endif
  63. Reboot.Wait:
  64. If Wait.Time!>0 Then
  65.   Print "Waiting for"+Str$(Wait.Time!)+" seconds."
  66.   Start.Time!=Timer
  67.   Var=0
  68.   While Var=0
  69.     Elapsed!=Timer-Start.Time!
  70.     If Elapsed!<0! Then
  71.       Elapsed!=Elapsed!+86400!
  72.     Endif
  73.     If Elapsed!>=Wait.Time! Then
  74.       Var=-1
  75.     Endif
  76.   Wend
  77.   Goto Reboot
  78. Endif
  79. Goto Reboot
  80. End
  81.  
  82. Reboot:
  83.  If Boot.Type=1 Then Goto Warm.Boot
  84.  If Boot.Type=2 Then Goto Cold.Boot
  85.  End
  86.  
  87. Command.Line:
  88.  Print "Bootcpu v2.0 command line:"
  89.  Print "  <wc> w=warm, c=cold"
  90.  Print "  [+#] wait for # seconds"
  91.  Print "  [t1,t2] range of time"
  92.  End 1
  93.  
  94. Warm.Boot:
  95.  Def Seg = 0
  96.  Poke &H473, &H12
  97.  Poke &H472, &H34
  98.  Def Seg = &HFFFF
  99.  Call Absolute(0)
  100.  Print "Warm boot failed!"
  101.  End 2
  102.  
  103. Cold.Boot:
  104.  Def Seg = &Hffff
  105.  Call Absolute(0)
  106.  Print "Cold boot failed!"
  107.  End 2
  108.